import { Button, Tabs } from 'antd';
import { useState } from 'react';
function Editor({fileList,openFile}) {
    const [activeKey, setActiveKey] = useState(fileList[0].key)
    const [fileData, setFileData] = useState(fileList[0].data)
    const onChange = (v) => {
        console.log('%c 修改东西','color:#005', v)
        setActiveKey(v);
    }
    const onEdit = (targetKey, action) => {
        if (action === 'add') {
            openFile();
        } else {
            // remove(targetKey);
        }
    };
    return (<div className="flex w-full">
        <Tabs 
            onChange={onChange}
            activeKey={activeKey}
            items={fileList}
            onEdit={onEdit}
            type="editable-card"
            className='w-full'
        />
        <div></div>
    </div>)
}

export default Editor